if exists (select 1
            from  sysobjects
           where  id = object_id('bd_v_deptAgTree')
            and   type = 'V')
   drop view bd_v_deptAgTree
go

/*==============================================================*/
/* View: bd_v_deptAgTree                                        */
/*==============================================================*/
create view bd_v_deptAgTree as
SELECT dep_serial, dep_parent, dep_order, dep_name, dep_no, dep_rule, dep_regserial, jz_dt_abbreviation, dep_teachserial, dep_lx, dep_domain, id auto_id, dep_no_add, dep_no_parent, old_dep_no
 , dbo.bd_fn_deptAgTree(dep_serial) tree_node
FROM dt_dep
go
